<?php
// +----------------------------------------------------------------------
// | 跃飞 [ 将来的你一定会感激现在奋斗的自己 ]
// +----------------------------------------------------------------------
// | Author: 钟贵廷
// +----------------------------------------------------------------------
// | Author URI: https://git.oschina.net/yeafy
// +----------------------------------------------------------------------
// | weChat:gt845272922  qq:845272922
// +----------------------------------------------------------------------


namespace app\yeafy\singleton;


class Student
{
    private $age = 1;
    private static $instance = null; //静态属性可以在静态方法里面调用

    /**
     * Student constructor.
     */
    private function __construct()
    {
    }

    private function __clone()
    {
        // TODO: Implement __clone() method.
    }


    /**
     * @return int
     */
    public function getAge()
    {
        return $this->age;
    }

    /**
     * @param int $age
     */
    public function setAge($age)
    {
        $this->age = $age;
    }



    public static function getInstance()
    {
        if(self::$instance === null)
        {
            self::$instance = new self;
        }
        return self::$instance;
    }


}